/*
 * @Author: ljb
 * @Description: 
 * @Date: 2021-09-16 14:57:51
 * @LastEditTime: 2021-09-23 21:43:30
 * @FilePath: \blog-vue\src\router\index.js
 */
import { createRouter, createWebHashHistory } from 'vue-router'
import Layout from '@/layout/index.vue'
import Home from '@/views/home/index.vue'
import Classify from '@/views/classify/index.vue'
import LeavingAMessage from '@/views/leaving-a-message/index.vue'
import Album from '@/views/album/index.vue'
import Case from '@/views/case/index.vue'


export const routes = [{
    path: '/',
    redirect: '/home',
    component: Layout,
    children: [{
        path: 'home',
        component: Home,
        meta: {
            name: 'Home',
            title: '首页'
        }
    }, {
        path: 'classify',
        component: Classify,
        meta: {
            name: 'Classify',
            title: '分类'
        }
    }, {
        path: 'leaving-a-message',
        component: LeavingAMessage,
        meta: {
            name: 'LeavingAMessage',
            title: '留言'
        }
    }, {
        path: 'album',
        component: Album,
        meta: {
            name: 'Album',
            title: '相册'
        }
    }, {
        path: 'case',
        component: Case,
        meta: {
            name: 'Case',
            title: '案例'
        }
    }]
}]

const router = createRouter({
    history: createWebHashHistory(),
    routes,
    // 页面跳转后自动滚动到最上面
    scrollBehavior () {
        return { top: 0, left: 0 }
    }
})

export default router
